home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / GRAPHICS.SWG / 0093_Multicolour Text Scroll.pas < prev    next >
Pascal/Delphi Source File  |  1994-05-25  |  2KB  |  80 lines

  1.  
  2. program multicolourtextscroll;
  3. uses crt;
  4. const sseg : word = $b800; hi = 16; wideness = 1;
  5.   txt : string = 'Multicoloured smooth text scroller!   ';
  6.   maxcols = 17; cols : array[0..maxcols] of byte =
  7.     (8, 8, 8, 7, 8, 7, 7, 15, 7, 15, 15, 15, 7, 15, 7, 7, 8, 7);
  8. var idx : word; i, cur, line, bitpos : byte;
  9.     ccol : byte; colw : byte; ch : char;
  10.  
  11. procedure retrace; assembler;
  12. asm
  13.   mov dx,3dah;
  14.   @l1: in al,dx; test al,8; jnz @l1;
  15.   @l2: in al,dx; test al,8; jz @l2;
  16. end;
  17.  
  18. procedure movecharsleft(startingrow : word); assembler;
  19. asm
  20.   push  ds;
  21.   mov   ax,$b800;
  22.   mov   ds,ax;
  23.   mov   di,2
  24.   @@MoveByte:
  25.     add   di,startingrow;
  26.     mov   al,[ds:di];
  27.     sub   di,2
  28.     mov   [ds:di],al;
  29.     sub   di,startingrow;
  30.     add   di,4
  31.     cmp   di,160
  32.   jl      @@MoveByte;
  33.   pop   ds
  34. end;
  35.  
  36. procedure movecolsright(startingrow : word); assembler;
  37. asm
  38.   push  ds
  39.   mov   ax,$b800
  40.   mov   ds,ax
  41.   mov   di,161
  42.   @@MoveByte:
  43.     add   di,startingrow
  44.     sub   di,4
  45.     mov   al,[ds:di]
  46.     add   di,2
  47.     mov   [ds:di],al
  48.     sub   di,startingrow
  49.     cmp   di,0001
  50.   ja      @@MoveByte
  51.   pop   ds
  52. end;
  53.  
  54.  
  55. begin
  56.   textattr := 7; clrscr; ccol := 1; idx := 1; colw := 0;
  57.   repeat
  58.     inc(colw);
  59.     retrace;
  60.     mem[$b800:hi*160+158] := ord(txt[idx]);
  61.     movecharsleft(hi*160);
  62.     if (colw > 1) then begin
  63.       colw := 0; inc(ccol);
  64.       mem[$b800:hi*160+1] := cols[ccol mod (maxcols+1)];
  65.       movecolsright(hi*160);
  66.     end;
  67.     if not keypressed then idx := 1 + idx mod length(txt);
  68.   until keypressed;
  69.   while keypressed do ch := readkey; textattr := 7; clrscr;
  70. end.
  71.  
  72. The push/pop ds might be superfluous... I don't know if you need them or not...
  73. I'm just starting assembly, you know.  :^)
  74. It's kinda like the one you made, but it doesn't lock up on my computer -- you
  75. can't check port[$60] on XTs.  :^)
  76. And in this, the colours move one way, and the text, the other.  It's kinda
  77. distracting when you're trying to read the scroll, but oh well...
  78. C-YA.
  79.  
  80.